<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>原型链</title>
</head>
<body>
  <script>
    // 类继承
    function SuperType() {
      this.property = true;
    }

    SuperType.prototype.getSuperValue = function() {
      return this.property;
    };

    function SubType() {
      this.subProperty = false;
    }

    // 继承 SuperType
    SubType.prototype = new SuperType();

    SubType.prototype.getSubValue = function() {
      return this.subProperty;
    };

    let instance = new SubType();

    console.log(instance.getSuperValue());  // true
  </script>
</body>
</html>